home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / SystemLogging.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  5KB  |  203 lines

  1. /*
  2.      File:        SystemLogging.h
  3.  
  4.      Contains:    System Logging Service
  5.  
  6.      Version:    Technology:    1.0
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __SYSTEMLOGGING__
  19. #define __SYSTEMLOGGING__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __TEXTOBJECTS__
  25. #include <TextObjects.h>
  26. #endif
  27. #ifndef __TIMEOBJECTS__
  28. #include <TimeObjects.h>
  29. #endif
  30. #ifndef __AEDATAMODEL__
  31. #include <AEDataModel.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT_SUPPORTED
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #if FOR_SYSTEM8_PREEMPTIVE
  47. #if FOR_PTR_BASED_AE
  48. /* Service types */
  49. typedef UInt32 LogID;
  50. typedef UInt32 LogIterator;
  51. /* Situation Types */
  52. typedef UInt32 LogSituationType;
  53.  
  54. enum {
  55.     kLogTypeInformation            = 'info',
  56.     kLogTypeWarning                = 'warn',
  57.     kLogTypeFatal                = 'fatl',
  58.     kLogTypeSystemFatal            = 'sysf',
  59.     kLogTypeAll                    = '****'
  60. };
  61.  
  62. /* System Logging Areas */
  63. typedef UInt32 LogArea;
  64.  
  65. enum {
  66.     kLogAreaIO                    = 'io  ',
  67.     kLogAreaNetworking            = 'netw',
  68.     kLogAreaKernel                = 'kern',
  69.     kLogAreaApplication            = 'appl',
  70.     kLogAreaBoot                = 'boot',
  71.     kLogAreaPrinting            = 'prnt',
  72.     kLogAreaCommunication        = 'comm',
  73.     kLogAreaServer                = 'serv',
  74.     kLogAreaAll                    = '****'
  75. };
  76.  
  77. /* Service Version */
  78. typedef UInt32 LogVersion;
  79.  
  80. enum {
  81.     kLogVersion1                = 1,
  82.     kLogCurrentVersion            = kLogVersion1
  83. };
  84.  
  85. /* Log Message Versions */
  86. typedef UInt32 LogMsgVersion;
  87.  
  88. enum {
  89.     kLogMsgVersion1                = 1,
  90.     kLogCurrentMsgVersion        = kLogMsgVersion1
  91. };
  92.  
  93. /* Message Flags */
  94. typedef UInt32 LogMsgFlags;
  95.  
  96. enum {
  97.     kLogMsgFlagsDataTruncated    = 0x00000001,
  98.     kLogMsgFlagsReceivedCorrupted = 0x00000002,
  99.     kLogMsgFlagsTimeInUptime    = 0x00000004,
  100.     kLogMsgFlagsNotified        = 0x00000008
  101. };
  102.  
  103. struct LogMessage {
  104.     ByteCount                         msgSize;
  105.     LogMsgVersion                     msgVersion;
  106.     LogMsgFlags                     msgFlags;
  107.     LogSituationType                 msgSituationType;
  108.     UInt32                             msgRepeatedCount;
  109.     LogArea                         msgArea;
  110.     OSType                             msgClient;
  111.     TimeObject                         msgTimestamp;
  112.     ByteCount                         msgDataCount;
  113.     OSStatus                         msgStatus;
  114.     ByteCount                         msgTextSize;
  115. };
  116. typedef struct LogMessage LogMessage;
  117.  
  118. typedef LogMessage *LogMessagePtr;
  119.  
  120. enum {
  121.     kLogMaxMessageSize            = 1024
  122. };
  123.  
  124. typedef UInt32 LogStatisticsVersion;
  125.  
  126. enum {
  127.     kLogStatisticsVersion1        = 1,
  128.     kLogStatisticsCurrentVersion = kLogStatisticsVersion1
  129. };
  130.  
  131. /* System Logging Statistics */
  132. struct LogStatistics {
  133.     LogStatisticsVersion             statsVersion;
  134.     UInt32                             situationMsgsDropped;
  135.     UInt32                             situationMsgsTruncated;
  136.     UInt32                             situationMsgsLoggedThisSession;
  137.     UInt32                             situationMsgsCurrentlyInTheLog;
  138.     UInt32                             situationMsgsNotified;
  139.     UInt32                             pluginsInstalled;
  140. };
  141. typedef struct LogStatistics LogStatistics;
  142.  
  143. /* Variables and constants for use in the System Notication Service */
  144.  
  145. enum {
  146.     kSystemLoggingService        = 'slss',
  147.     kLogSNSMsgKind                = 'slsm',
  148.     kLogSNSMsgSubjectSize        = 12
  149. };
  150.  
  151. #define    kLogSNSMsgSubject    "SystemLogMsg"
  152. /* Basic Logging routine */
  153. extern OSStatus LogSituation(LogSituationType situationType, LogArea situationArea, OSType situationClient, TextObject situationText, OSStatus situationStatus, AEStream situationData);
  154.  
  155. /* System Logging Service Administration APIs */
  156. extern OSStatus LogOpen(LogID *theService, TextObject clientName);
  157.  
  158. extern OSStatus LogClose(LogID theService);
  159.  
  160. extern OSStatus LogGetClientName(TextObject clientName);
  161.  
  162. extern OSStatus LogClear(LogID theService);
  163.  
  164. extern OSStatus LogFlush(LogID theService);
  165.  
  166. extern OSStatus LogGetCommAreaSize(LogID theService, ByteCount *size);
  167.  
  168. extern OSStatus LogSetCommAreaSize(LogID theService, ByteCount size);
  169.  
  170. extern OSStatus LogCreateIterator(LogID theService, LogIterator *iterator);
  171.  
  172. extern OSStatus LogGetEntry(LogIterator iterator, LogMsgVersion version, LogMessage *msg);
  173.  
  174. extern OSStatus LogDisposeIterator(LogIterator iterator);
  175.  
  176. extern OSStatus LogExtractText(LogMessage *entry, TextObject text);
  177.  
  178. extern OSStatus LogExtractAEDesc(LogMessage *entry, AEDesc *desc);
  179.  
  180. extern OSStatus LogGetStatistics(LogID theService, LogStatisticsVersion version, LogStatistics *statistics);
  181.  
  182. extern OSStatus LogGetLogSize(LogID theService, ByteCount *maxSize);
  183.  
  184. extern OSStatus LogSetLogSize(LogID theService, ByteCount maxSize);
  185.  
  186. #endif
  187. #endif
  188.  
  189. #if PRAGMA_ALIGN_SUPPORTED
  190. #pragma options align=reset
  191. #endif
  192.  
  193. #if PRAGMA_IMPORT_SUPPORTED
  194. #pragma import off
  195. #endif
  196.  
  197. #ifdef __cplusplus
  198. }
  199. #endif
  200.  
  201. #endif /* __SYSTEMLOGGING__ */
  202.  
  203.